#include<iostream>
#include<unistd.h>
#include<cassert>
#include<cstdlib>
#include<sys/types.h>
#include<sys/wait.h>

int main()
{
    printf("process id running'''\n");
    pid_t id = fork();
    if(id == 0)
    {
        printf("我是子进程，我的pid: %d\n", getpid());
        sleep(1);
        execl("./mycpp", "mycpp", NULL);
        exit(-1);
    }

    //int status = 0;
    // pid_t ret = waitpid(id, &status, 0);
    // if(ret > 0) printf("wait success: exit code: %d  sig: %d\n", (status>>8)&0xFF, status & 0x7F);
    printf("我是原程序的父进程，我的pid：%d\n", getpid());
    printf("我是原程序的父进程，我的pid：%d\n", getpid());
    printf("我是原程序的父进程，我的pid：%d\n", getpid());
    return 0;
}